package org.example.java.base;

/**
 * User: ZhangJuntao
 * Date: 13-11-19
 * Time: 下午12:02
 */
public class CompareTest {
  private static void testCompareTo() {
    System.out.println("=====Integer compareTo=====");
    Integer a = 10;
    System.out.println("10 compareTo 2:" + a.compareTo(2));
    System.out.println("10 compareTo 10:" + a.compareTo(10));
    System.out.println("10 compareTo 20:" + a.compareTo(20));

    System.out.println("=====String compareTo=====");
    System.out.println("aa compareTo ab:" + "aa".compareTo("ab"));
    System.out.println("ab compareTo ab:" + "ab".compareTo("ab"));
    System.out.println("ab compareTo aa:" + "ab".compareTo("aa"));
    System.out.println("a compareTo defg:" + "a".compareTo("defg"));
    System.out.println("ab compareTo abcde:" + "ab".compareTo("abcde"));
  }

  public static void main(String[] args) {
    testCompareTo();
  }
}
